package socket.InetAddress;

import java.net.MalformedURLException;
import java.net.URL;

/**
 * @description: 了解URL基本信息
 * @author: Fesine
 * @createTime:2016/9/29 21:23
 * @update:修改内容
 * @author: Fesine
 * @updateTime:2016/9/29 21:23
 */
public class TestURL {
    public static void main(String[] args) throws MalformedURLException {
        URL fesine = new URL("http://www.fesine.com");
        URL url = new URL(fesine, "/index.html?username=fesine#test");
        System.out.println("协议：" + url.getProtocol());
        System.out.println("主机：" + url.getHost());
        System.out.println("端口号：" + url.getPort());
        System.out.println("文件路径：" + url.getPath());
        System.out.println("文件：" + url.getFile());
        System.out.println("相对路径：" + url.getRef());
        System.out.println("参数：" + url.getQuery());
    }
}
